
;;================================================================
;; Routine to make various analysis plots in support of the IRDC
;;   distance modeling code.


;; Define the COMMON BLOCK
COMMON FFORE_BLOCK,n,rb3,R0,d,R,Z,tau,f_data,sig_f,corr,farlist,do_Tfit,$
   lpstr,rho_hi,rho_h2,rho_star

;; Since we are using routines buried in BGPS_FFORE, compile now to
;; they are available.
FORWARD_FUNCTION BGPS_FFORE_MODEL, BGPS_FFORE_LOOPIE
RESOLVE_ROUTINE, 'BGPS_FFORE', /COMPILE_FULL_FILE, /EITHER

;; Get galactic params
defsysv, '!MW', exists = exists
IF NOT exists THEN galactic_params 
;; Using !MW parameters -- Goes into COMMON block!
R0 = !MW.R0

restore,'./irdc_dist_model/bgps_rb3.sav',/ver
restore,'./irdc_dist_model/data/case4_irdc_TdFIT.sav',/ver
restore,'./irdc_dist_model/fitdist.sav',/ver

;; Define arrays for TEMP_DEPENDENT_VARIABLES
n = n_elements(rb3)
tau    = dblarr(n)
f_data = dblarr(n)
sig_f  = dblarr(n)

plotsym,0,0.5,/fill


myps,'./irdc_dist_model/analysis_plots/flux_dist_plot.eps',xsize=5

sun = cgSymbol('Sun')

plot,rb3.s_peak/1.d3,fitdist/1.d3,psym=8,xtit='S!d1.1!n [Jy]',$
     ytit='d!d'+sun+'!n [kpc]',/xlog,xr=[0.04,5],/xst
;; st = findgen(101)/50.
;; dt = -10*st+20.
;oplot,st,dt,color=cgColor('Blue'),thick=2,linestyle=3
;; oplot,rb3[funny].s_peak/1.d3,fitdist[funny]/1.d3,psym=8,$
;;       color=cgColor('Deep Pink')



print,n_elements(rb3)

myps,/done

END
